Functions and Operators
Trigonometry Functions
Following table lists all the Trigonometry Functions available in Calculation Engine and their details:
Name |
Parameters |
Example |
Remarks |
---|---|---|---|
sin |
value |
sin(A deg), sin(A rad) |
Returns the sine of the specified angle. |
cos |
value |
cos(A deg), cos(A rad) |
Returns the cosine of the specified angle. |
tan |
value |
tan(A deg), tan(A rad) |
Returns the tangent of the specified angle. |
sinh |
value |
sinh(A deg), sinh(A rad) |
Returns the hyperbolic sine of the specified angle. |
cosh |
value |
cosh(A deg), cosh(A rad) |
Returns the hyperbolic cosine of the specified angle. |
tanh |
value |
tanh(A deg), tanh(A rad) |
Returns the hyperbolic tangent of the specified angle. |
asin |
value |
asin(A) |
Returns the angle in radian whose sine is the specified number. |
acos |
value |
acos(A) |
Returns the angle in radian whose cosine is the specified number. |
atan |
value |
atan(A) |
Returns the angle in radian whose tangent is the specified number. |
asinh |
value |
asinh(A) |
Returns the angle in radian whose hyperbolic sine is the specified number. |
acosh |
value |
acosh(A) |
Returns the angle in radian whose hyperbolic cosine is the specified number. |
atanh |
value |
atanh(A) |
Returns the angle in radian whose hyperbolic tangent is the specified number. |
degreeToRadian |
value |
degreeToRadian(A) |
Returns the angle in radian |
radianToDegree |
value |
radianToDegree(A) |
Returns the angle in degree |
Logarithmic Functions
Following table lists all the Logarithmic Functions available in Calculation Engine and their details:
Name |
Parameters |
Example |
Remarks |
---|---|---|---|
log10 |
value |
log10(A) |
Returns the base 10 logarithm of a specified number. |
log2 |
value |
log2(A) |
Returns the base 2 logarithm of a specified number. |
ln |
value |
ln(A) |
Returns the base e logarithm of a specified number. |
log |
value, base |
log(A, 10) |
Returns the logarithm of a specified number in a specified base. |
Mathematical Functions
Following table lists all the Mathematical Functions available in Calculation Engine and their details:
Name |
Parameters |
Example |
Remarks |
---|---|---|---|
squareroot |
value |
squareroot(A) |
Returns the square root of a specified number. |
cuberoot |
value |
cuberoot(A) |
Returns the cube root of a specified number. |
nPr |
n, r |
nPr(n, r) |
Returns the permutation for the specified value of n and r. |
nCr |
n, r |
nCr(n, r) |
Returns the combination for the specified value of n and r. |
Abs() |
any number of parameters |
Abs(-10), Abs(10) will be 10 |
Returns the absolute value of the specified field. Also know as returning a negative value as positive value. |
Bitwise Functions
Following table lists all the Bitwise functions available in Calculation Engine and their details:
Name |
Parameters |
Example |
Remarks |
---|---|---|---|
subbits8 |
value, start, length |
subbits8 (value, start, length) |
Returns the value of subbits of a 8 bit number. |
subbits16 |
value, start, length |
subbits16 (value, start, length) |
Returns the value of subbits of a 16 bit number. |
subbits24 |
value, start, length |
subbits24 (value, start, length) |
Returns the value of subbits of a 24 bit number. |
subbits32 |
value, start, length |
subbits32 (value, start, length) |
Returns the value of subbits of a 32 bit number. |
-
Every parameter for each function can have a numeric value, variable or any expression.
-
Cascading function call is also allowed. Example: radianToDegree (asin(sin(30 deg)))
-
Function name are not case sensitive.
Binary and Hex Literals Functions
Following table lists all the Binary and Hex literals functions available in Calculation Engine and their details:
Name | Parameters | Example | Remarks |
---|---|---|---|
Binary Literal | 5*0b0010 | 5*0b0010 => 5*2 = 10 |
If the literal starts with 0b, then rest of the number (that is, 0010) is considered as binary number. This binary number is converted to equivalent decimal number and the operation (*) is carried out. |
Hex Literal | 5*0x0a | 5*0x0a => 5*10 = 50 | If the literal starts with 0x, then rest of the number (that is, oa) is considered as Hex number. This Hex number is converted to equivalent decimal number and the operation (*) is carried out. |
Aggregation Functions
Following table lists all the Aggregation Functions available in Calculation Engine and their details.
Name |
Parameters |
Example |
Remarks |
---|---|---|---|
Min() |
any number of parameters |
Min(A, B) Min(A, B, C) Min(A, B, C, D) |
Returns the smallest value of the specified field. |
Max() |
any number of parameters |
Max(A, B) Max(A, B, C) Max(A, B, C, D) |
Returns the largest value of the specified field. |
Sum() |
any number of parameters |
Sum(A, B) |
Returns the returns the sum of all the values in the specified field. |
Avg() |
any number of parameters |
Avg(X) |
Returns the average of the values in a specified field. |
Constants
Following are the prebuilt Constants available in the Calculation Engine:
-
Pi (π)
-
Tau (τ)
-
Exponential (e)
Operators
Following are the prebuilt Operators available in the Calculation Engine:
-
Addition (+)
[a] + [b]
-
Subtraction (-)
[a] - [b]
-
Multiplication (*)
[a] * [b]
-
Division (/)
[a] / [b]
-
Brackets ( "(" ,")" )
[a] + ([b] - [c])
-
Modulus (mod)
[a] mod [b]
-
Power (^)
[a] ^ 2
Comparison Operators
Following are the prebuilt Comparison Operator available in the Calculation Engine:
-
Greater than (>)
if a= 10 , b = 3 then a > b will return true
-
Greater than (<)
if a= 10 , b = 3 then a < b will return false
-
Greater than or equal to (>=)
if a= 10 , b = 3 then a >= b will return true
-
Less than or equal to (<=)
if a= 10 , b = 3 then a <= b will return false
-
Equal to (=)
if a= 10 , b = 3 then a = b will return false
-
Not Equal to (!=)
if a= 10 , b = 3 then a != b will return true
Bitwise Operators
Bitwise operators are used on integers. Following are the prebuilt Bitwise Operator available in the Calculation Engine:
-
AND (&)
If a = 5, b = 1 then a & b will return 1
-
OR (|)
If a = 5, b = 1 then a | b will return 5
-
Left Shift (<<)
If a = 5, b = 1 then a << b will return 10
-
Right Shift (>>)
If a = 5, b = 1 then a >> b will return 2
-
OnesComplement Operator (~)
If a = 5 the ~a will return -6
Logical Operators
Following are the prebuilt Logical Operators available in the Calculation Engine:
Logical operators are typically used with boolean (logical) values, and when they are processed, they return a boolean value.
-
And ('and')
if a = 10 , b = 3 , c = 2 , d = 5 then (a > b) and ( c < d) will return true
if a = 10 , b = 3 , c = 2 , d = 5 then (a > b) and ( c > d) will return false
-
Or {'or'}
if a = 10 , b = 3 , c = 2 , d = 5 then (a > b) or ( c < d) will return true
if a = 10 , b = 3 , c = 2 , d = 5 then (a > b) or ( c > d) will return true
if a = 10 , b = 3 , c = 2 , d = 5 then (a < b) or ( c > d) will return false
-
Not (not)
if a = 10 , b = 3 , c = 2 , d = 5 then not ((a > b) or ( c < d)) will return false
if a = 10 , b = 3 , c = 2 , d = 5 then not ((a > b) or ( c > d)) will return false
if a = 10 , b = 3 , c = 2 , d = 5 then not ((a < b) or ( c > d)) will return true
Expression for Predicates
example :- a = 10 , b = 3 , c = 2 , d = 5
e.g. ([a]+ [b]) > ([c] + [d])
This will be evaluated as
(10 + 3) > ( 2 + 5)
= (13) > (7) => true
Conditional Operators
case when <condition-expression> then <value-expression>
when <condition-expression> then <value-expression>
else <value-expression>
end
condition-expression can be any expression or nested expression which results the value in true or false.
value-expression can be any expression or nested expression.
Examples
case when [b] > 1 then [a] - [b]
when [b] < 1 then [a] + [b]
else 0
end